The present invention relates to computer systems. More specifically, the invention relates to utilizing weighting attributes on connections from a connection cache.
In computer systems, it is common for an application to obtain a connection to a desired resource. An application programming interface (API) can define the calls that obtain a connection, access the resource, close a connection, and the like. For example, the JAVA database connectivity (JDBC) is an API that allows JAVA applications to connect and access databases. JAVA is a trademark of Sun Microsystems, Inc.
Establishing a connection and closing a connection can take unwanted time and processing capability. Accordingly, it is known to pool connections in a connection cache. When an application wants a connection from the cache, a request for a connection from the cache is sent and fulfilled with a connection from the cache (or a new connection). When that application is finished with the connection, the application closes the connection and the connection is returned to the cache. Thus, if another application (or the same one at a later point in time) requests a connection from the cache, the connection can be readily been given from the cache, if available.
Traditionally, connections were retrieved from the connection cache based on the user that has been authenticated with the connections. For example, an application may request a connection for a user Scott (and password). If a connection is available in the cache that has been authenticated for this user, this connection is utilized to satisfy the request.
Inefficiencies can occur if once the client has the connection, changes are made to the session. For example, attributes such as the NLS language or transaction isolation level could be changed. Once this connection is returned to the cache, there may not be a mechanism to request this connection at a later time.
One could request that all applications return the connections to a default state before releasing them back to the cache. However, some applications may fail to do this. Additionally, changing attributes of a session each time a connection is retrieved and changing them back to a default state may be very inefficient.
Accordingly, it would be desirable to have innovative techniques of retrieving connections with desired attributes from a connection cache. Additionally, it would be beneficial if closest match connections could be identified to satisfy connection requests that specify desired attribute values.